Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add db.sql stat collector #5146

Merged
merged 8 commits into from
Oct 1, 2024
Merged

chore: add db.sql stat collector #5146

merged 8 commits into from
Oct 1, 2024

Conversation

lvrach
Copy link
Member

@lvrach lvrach commented Sep 27, 2024

Description

In this PR, database stats collect is added in all sql.DB instances. This will allow us to monitor open/close connection and connections waiting.

Some additional modifications where due to:

  • Passing stats.Stats using DI
  • Stats collector, has a name uniqueness limitation. This is to prevent from metrics being accidentally overidden leading to corrupted stats. A lot of tests had to be modified, not use stats.Default.

Linear Ticket

https://linear.app/rudderstack/issue/PRI-48/collect-database-sql-stats

resolves PRI-48

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Copy link

codecov bot commented Sep 30, 2024

Codecov Report

Attention: Patch coverage is 65.48673% with 39 lines in your changes missing coverage. Please review.

Project coverage is 72.99%. Comparing base (ef57540) to head (60bdc5c).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
app/apphandlers/processorAppHandler.go 5.88% 16 Missing ⚠️
services/rsources/rsources.go 42.85% 2 Missing and 2 partials ⚠️
enterprise/reporting/error_reporting.go 0.00% 3 Missing ⚠️
enterprise/reporting/flusher/factory.go 25.00% 2 Missing and 1 partial ⚠️
...ise/reporting/error_index/error_index_reporting.go 33.33% 1 Missing and 1 partial ⚠️
enterprise/trackedusers/users_reporter.go 33.33% 1 Missing and 1 partial ⚠️
internal/drain-config/drainConfig.go 66.66% 1 Missing and 1 partial ⚠️
jobsdb/jobsdb.go 93.54% 2 Missing ⚠️
services/notifier/notifier.go 33.33% 1 Missing and 1 partial ⚠️
warehouse/app.go 33.33% 1 Missing and 1 partial ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5146      +/-   ##
==========================================
+ Coverage   72.88%   72.99%   +0.10%     
==========================================
  Files         439      439              
  Lines       51159    51165       +6     
==========================================
+ Hits        37288    37346      +58     
+ Misses      11419    11368      -51     
+ Partials     2452     2451       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lvrach lvrach marked this pull request as ready for review October 1, 2024 06:18
Copy link
Member

@achettyiitr achettyiitr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also get rid of sqlutil.MonitorDatabase usage as well.

app/apphandlers/processorAppHandler.go Outdated Show resolved Hide resolved
@lvrach lvrach enabled auto-merge (squash) October 1, 2024 08:32
@lvrach lvrach merged commit 61e947c into master Oct 1, 2024
54 checks passed
@lvrach lvrach deleted the chore.add-db-pool-stats branch October 1, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants